Description
Makes glint usable as a quick-edit editor for code (not just markdown) so it can reasonably be set as $EDITOR. Alabaster philosophy: color only a few token types, leave the rest base.
Three pieces:
- File-type routing: the editor selects a scanner by the file's extension โ .md/.markdown/.txt/none -> the existing markdown scanner; known code extensions (.go .py .js .ts .rs .c .h .java .rb .sh .lua .toml .yaml .json โฆ) -> a code scanner. Add editor.SetLanguage/SetScanner; app sets it in Load() from filepath.Ext.
- Code scanner via chroma (already a transitive dep through glamour โ promote to direct). Use chroma's lexer-by-filename to tokenize, then map ONLY: String* -> string color (reuse Code, or a new String role); Comment* -> Comment (visible); Number/Literal -> Accent; Keyword/Name/Operator -> base Text; Punctuation -> Muted. Everything else base. Split the chroma token stream into per-line []Span; the concatenated span text must equal the raw line (markup-visible / display-only invariant, same as the markdown scanner). Handle multi-line tokens (block comments, multi-line strings).
- Theme: reuse Code/Comment/Accent/Muted; optionally add a dedicated String role if strings should differ from inline-code green.
Keep it minimal and calm (Alabaster), not a full IDE theme. Not the main code editor โ just 'open, read okay, small change, save'. Verify cursor/selection/wrap still work over code (tabs/CJK width is TASK-005).
Acceptance Criteria
- #1 Code files (by extension) use a minimal code scanner; markdown/text keep the markdown scanner
- #2 Only strings, comments, and numbers/constants are colored (Alabaster-minimal); keywords/identifiers stay base, punctuation dimmed
- #3 Uses the chroma lexer already bundled via glamour; spans concatenate to the raw line (display-only invariant)
- #4 Multi-line tokens (block comments, multi-line strings) handled across lines